package com.umakr.ax.app.web;

import com.umakr.ax.app.service.SeekHelpInfoWebService;
import com.umakr.ax.common.service.SeekHelpInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import com.umakr.ax.common.model.SeekHelpInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import io.swagger.annotations.ApiOperation;

import com.umakr.ax.core.base.AbstractController;

/**
 * <p>
 * 求助信息  前端控制器
 * </p>
 *
 * @author Umakr-Code-Generator
 * @since 2017-12-30
 */
@Controller
@RequestMapping("/api/web/seekHelpInfo")
public class SeekHelpInfoWebController extends AbstractController {
	@Autowired
	SeekHelpInfoWebService seekHelpInfoWebService;

	@ApiOperation(value = "主播一键推送")
	@GetMapping("/updateSeekHelpInfoPushStatus")
	@ResponseBody
	public Object updateSeekHelpInfoPushStatus(ModelMap modelMap,@RequestParam(name = "helpId") Long helpId, @RequestParam(name = "pushStatus") Integer pushStatus) {
		return setSuccessModelMap(modelMap,seekHelpInfoWebService.updateSeekHelpInfoPushStatus(helpId,pushStatus));
	}

	@ApiOperation(value = "求助信息标识已解决")
	@GetMapping("/updateSeekHelpInfoDealStatus")
	@ResponseBody
	public Object updateSeekHelpInfoDealStatus(ModelMap modelMap,@RequestParam(name = "helpId") Long helpId, @RequestParam(name = "dealStatus") Integer dealStatus) {
		return setSuccessModelMap(modelMap,seekHelpInfoWebService.updateSeekHelpInfoDealStatus(helpId,dealStatus));
	}

	@ApiOperation(value = "电台软删除求助信息")
	@GetMapping("/delSeekHelpInfo")
	@ResponseBody
	public Object delSeekHelpInfo(ModelMap modelMap,@RequestParam(name = "helpId") Long helpId, @RequestParam(name = "delStatus") Integer delStatus) {
		return setSuccessModelMap(modelMap,seekHelpInfoWebService.delSeekHelpInfo(helpId,delStatus));
	}

	@ApiOperation(value = "电台发布的求助信息列表")
	@GetMapping("/listRsPubSeekHelpInfo")
	@ResponseBody
	public Object listRsPubSeekHelpInfo(ModelMap modelMap,@RequestParam(name = "rsId") Long rsId,String searchText) {
		return setSuccessModelMap(modelMap, seekHelpInfoWebService.listRsPubSeekHelpInfo(rsId,searchText));
	}

	@ApiOperation(value = "电台发布求助信息")
	@PostMapping("/saveByRs")
	@ResponseBody
	public Object saveByRs(ModelMap modelMap,SeekHelpInfo seekHelpInfo,String userName) {
		return setSuccessModelMap(modelMap,seekHelpInfoWebService.saveByRs(seekHelpInfo,userName));
	}

	@ApiOperation(value = "根据id获取求助信息")
	@GetMapping("/getSeekHelpInfoById")
	public Object getSeekHelpInfoById(ModelMap modelMap,@RequestParam(name = "seekHelpId") Long seekHelpId) {
		return setSuccessModelMap(modelMap,seekHelpInfoWebService.getSeekHelpInfoById(seekHelpId));
	}


}